package com.homework;

import com.sun.source.tree.IfTree;

import javax.print.DocFlavor;
import java.util.Scanner;

public class Test802 {
    public static void main(String[] args) {
       String username = "admin";
       String password = "123456";
        Scanner sc = new Scanner(System.in);
        for(int i = 1;i <=3 ;i++){
            System.out.println("请输入用户名:");
            String userName =sc.nextLine();
            System.out.println("请输入登录密码:");
            String passWord =sc.nextLine();
            if (username.equals(userName)&&password.equals(passWord)){
                System.out.println("登录成功");
                break;
            }else if(i==0){
                System.out.println("您的登录次数已用完,请明天再登录");
            }else{
                System.out.println("你输入的用户名或密码错误,你还可以输入"+(3-i) +"次");
            }

        }

    }
}
